<template>
    <view class="content">
        <view class="content-card">
            <view class="btn"><u-button type="primary" @click="handleAdd(type,title)">添加{{title}}</u-button></view>
            <view class="card-list" v-for="item in data">
                <view class="card-title">{{item.activity_name}}</view>
                <view class="card-body">
                    <view class="body-text">活动时间：{{item.begin_time}}</view>
                    <view class="body-text">活动地址：{{item.activity_add}}</view>
                </view>
                <view class="iconfont icon-weikaishi icon" v-if="item.state == 0"></view>
                <view class="iconfont icon-jinhangzhong icon" v-if="item.state == 1"></view>
                <view class="iconfont icon-yiwancheng icon" v-if="item.state == 2"></view>
                <view class="card-foot">
                    <u-button type="primary" @click="handleClick(type,item)">活动详情</u-button>
                    <u-button type="primary" @click="reportClick">查看活动报告</u-button>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        props:{
            title: {
                type: String,
                default: ''
            },
            type:{
                type:String,
                default: ''
            },
            data:{
                type:Array,
                default:[]
            }
        },
        data(){
            return{

            }
        },
        methods: {
            handleAdd(type,title){
                this.$tab.navigateTo(`/pages/home/add/index?type=`+type+'&title='+title)
            },
            //活动详情
            handleClick(type,data) {
                this.$tab.navigateTo(`/pages/activity/index?id=`+data.id+'&type='+type)
            },
            reportClick(){
                this.$tab.navigateTo(`/pages/activity/report`)
            }
        }
    }
</script>

<style lang="scss">
    .content{
        .content-card{
            padding: 0 15px;
            .btn{
                margin-top: 10px;
            }
            .card-list{
                background: #fff;
                border-radius: 10px;
                margin-top: 15px;
                padding: 10px 15px;
                position: relative;
                .card-title{
                    font-size: 25px;
                    color:#999;
                    border-bottom: 1px solid #eee;
                    padding-bottom: 15px;
                }
                .card-body{
                    padding: 15px 0;
                    border-bottom: 1px solid #eee;
                    margin-bottom: 10px;
                    .body-text{
                        font-size: 14px;
                        color:#666;
                        margin: 5px;
                    }
                }
                .card-foot{
                    display: flex;
                    justify-content: space-between;
                    .u-button{
                        margin: 0 5px;
                    }
                }
                .iconfont{
                    position: absolute;
                    top: 5px;
                    right: 20px;
                    font-size: 80px;
                }
                .icon-jinhangzhong{
                    color: #3c96f3;
                }
                .icon-weikaishi{
                    color:#999;
                }
                .icon-yiwancheng{
                    color:#666;
                }
            }
        }
    }
</style>
